<!-- 商家钱包表表单弹窗 -->
<form id="businesswallet-form" lay-filter="businesswallet-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">商家ID</label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入商家ID" type="text" class="layui-input" maxlength="20"  id="businessId"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">充值余额</label>
        <div class="layui-input-block">
            <input name="balance" placeholder="请输入充值余额" type="text" class="layui-input" maxlength="20"  id="balance"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">累计充值</label>
        <div class="layui-input-block">
            <input name="totalBalance" placeholder="请输入累计充值" type="text" class="layui-input" maxlength="20"  id="totalBalance"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">佣金余额</label>
        <div class="layui-input-block">
            <input name="commissionBalance" placeholder="请输入佣金余额" type="text" class="layui-input" maxlength="20"  id="commissionBalance"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">冻结佣金</label>
        <div class="layui-input-block">
            <input name="frozenCommission" placeholder="请输入冻结佣金" type="text" class="layui-input" maxlength="20"  id="frozenCommission"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">累计佣金</label>
        <div class="layui-input-block">
            <input name="totalCommission" placeholder="请输入累计佣金" type="text" class="layui-input" maxlength="20"  id="totalCommission"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">剩余积分</label>
        <div class="layui-input-block">
            <input name="scores" placeholder="请输入剩余积分" type="text" class="layui-input" maxlength="20"  id="scores"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">累计积分</label>
        <div class="layui-input-block">
            <input name="totalScores" placeholder="请输入累计积分" type="text" class="layui-input" maxlength="20"  id="totalScores"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">赠送余额</label>
        <div class="layui-input-block">
            <input name="giveBalance" placeholder="请输入赠送余额" type="text" class="layui-input" maxlength="20"  id="giveBalance"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">消费金额</label>
        <div class="layui-input-block">
            <input name="spendMoney" placeholder="请输入消费金额" type="text" class="layui-input" maxlength="20"  id="spendMoney"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">赠送总额</label>
        <div class="layui-input-block">
            <input name="totalGive" placeholder="请输入赠送总额" type="text" class="layui-input" maxlength="20"  id="totalGive"
                   lay-verify="required" required/>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var businesswallet = admin.getTempData('t_businesswallet');
           if (businesswallet.method=="update"){
        	form.val('businesswallet-form', businesswallet);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('business/businesswallet/'+businesswallet.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
